﻿using eProcurement.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eProcurement.controls
{
    public partial class MyProjectsItemControl : System.Web.UI.UserControl
    {
        protected void Page_Load( object sender, EventArgs e )
        {

        }

        public void Setup( Project project )
        {
            lblCloseDate.InnerText = project.CloseDate.ToString( "ddd d MMM yyyy" );
            lblPostDate.InnerText = project.DatePosted.ToString( "ddd d MMM yyyy" );
            lblprojectid.InnerText = project.Id.ToString();
            lblProjectTitle.InnerText = project.Title;
            projectlink.Attributes.Add( "href", "../members/Company.aspx?pid=" + project.Id );
            linkEdit.Attributes.Add( "href", "../members/EditProject.aspx?pid=" + project.Id );
            lblState.InnerText = project.State;

            if ( project.Description.Length > 160 )
            {
                lblDescription.InnerText = project.Description.Substring( 0, 160 ) + "...";
            }
            else
            {
                lblDescription.InnerText = project.Description;
            }
            lblBidders.InnerText = project.NumberBidders.ToString();
        }
    }
}